<?php

/**
* Fill in the url from name if value is empty
* 
*/
class Gallery_Form_Element_Filter_AutoUrl extends Kernel_Component 
    implements Kernel_Form_Element_Filter_Interface
{
    
    /**
     * Returns the result of filtering $value
     *
     * @param  mixed $value
     * @throws Kernel_firm_Element_Filter_Exception If filtering $value is impossible
     * @return mixed
     */
    public function filter($value, array $values = array()) 
    {
        if (!$value) {
            $value = $values['name'];
        }
        
        return $value;
    }
    
}